package com.xtayfjpk.zookeeper.test.master_workers.callback;

import org.apache.zookeeper.AsyncCallback.VoidCallback;
import org.apache.zookeeper.KeeperException.Code;

public class BaseVoidCallback implements VoidCallback {

	@Override
	public final void processResult(int rc, String path, Object ctx) {
		switch (Code.get(rc)) {
		case CONNECTIONLOSS:
			connectionLossCaseAction(rc, path, ctx);
			break;
		case OK:
			okCaseAction(rc, path, ctx);
            break;
		case NONODE:
			noNodeCaseAction(rc, path, ctx);
			break;

		default:
			defaultCaseAction(rc, path, ctx);
			break;
		}	
	}

	
	protected void connectionLossCaseAction(int rc, String path, Object ctx) {
		
	}
	protected void okCaseAction(int rc, String path, Object ctx) {
		
	}
	protected void noNodeCaseAction(int rc, String path, Object ctx) {
		
	}
	protected void defaultCaseAction(int rc, String path, Object ctx) {
		
	}
}
